package loveappservice.test;

import loveappservice.dao.User_dao;
import loveappservice.dao.impl.User_dao_impl;
import loveappservice.domain.Img;
import loveappservice.domain.Img_group;
import loveappservice.domain.Users;
import loveappservice.service.User_service;
import loveappservice.service.impl.User_service_impl;
import loveappservice.util.JDBCUtils;
import loveappservice.util.WxApi;
import org.junit.Test;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class testJDBC {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    User_dao dao = new User_dao_impl();
    User_service user_service = new User_service_impl();
    WxApi wxApi = new WxApi();

    @Test
    public void test2(){


    }

    @Test
    public void test3(){

        //System.out.println(dao.selectImg_group(2));

        List<Img_group> img_groups = user_service.selectImg_group(1);
        for (int i=0;i<img_groups.size();i++){
            List<Img> imgs = user_service.selcetImg(img_groups.get(i).getImg_group_id());
            Users users =user_service.finOneUser(img_groups.get(i).getUser_id());
            img_groups.get(i).setImg(imgs);
            img_groups.get(i).setUsers(users);


        }

        System.out.println(img_groups);

    }

    @Test
    public void test4(){
        System.out.println(dao.images_Exist("毕业照片"));
    }


    @Test
    public void test5() {
        System.out.println(dao.userlogin("xiaochen","12345"));

    }


    @Test
    public void test6() {
        String res =  wxApi.code2Session("0d1tof100aIeOQ1OLX300vNGE33tof1e");
        System.out.println(res);
    }



}
